package com.biz.user.event;

import com.alibaba.fastjson.*;
import lombok.extern.slf4j.*;
import org.springframework.stereotype.*;
import org.springframework.transaction.event.*;

/**
 * @Description
 *      监听
 * @Author liuxi
 * @Date 2024/5/10
 **/
@Service
@Slf4j
public class PersonEventListener {

    @TransactionalEventListener(fallbackExecution = true)
    public void listenerCreateEvent(PersonChangeEvent event) {
        switch (event.getOperateType()) {
            case "create":
                // 业务逻辑
                log.info("执行创建事件：{}", JSON.toJSONString(event.getPerson()));
                break;
            default:
                break;
        }
    }
}
